package org.lib.eshello.news.dao;

import java.util.List;

import org.lib.eshello.news.entity.News;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.data.util.Streamable;

public interface NewsDAO extends ElasticsearchRepository<News, String> {

	List<News> findByTitle(String title);
	
	// 没有数据返回
//	List<News> findByTitleContaining(String title);
	// 没有数据返回
	Streamable<News> findByTitleContaining(String title);
	
	/**
	 * 根据 title、contentText 分页查找
	 * @author ben
	 * @date 2021-09-01 16:02:10 CST
	 * @param title
	 * @param contentText
	 * @param page
	 * @return
	 */
	Page<News> findByTitleOrContentText(String title, String contentText, Pageable page);
	
	/**
	 * findByTitleContainingOrContentTextContaining
	 * @author ben
	 * @date 2021-09-01 19:26:53 CST
	 * @param title
	 * @param contentText
	 * @param page
	 * @return
	 */
	Page<News> findByTitleContainingOrContentTextContaining(String title, String contentText, Pageable page);
	
}
